package 周赛;

import org.junit.Test;

import java.util.ArrayList;

public class 检查句子中的数据是否递增 {

    public boolean areNumbersAscending(String s) {
        String[] s1 = s.split(" ");
        ArrayList<Integer> list = new ArrayList<>();
        for (String s2 : s1) {
            char c = s2.charAt(0);
            if ('0'<=c && c<='9')
                list.add(Integer.parseInt(s2));
        }
        for (int i = 0; i < list.size()-1; i++) {
            if (list.get(i)>list.get(i+1))
                return false;
        }
        return true;
    }
    @Test
    public void test(){
        String s1 = "12";
        String s2 = "abc";
        System.out.println(Integer.parseInt(s1));
        System.out.println(Integer.parseInt(s2));
    }
}
